﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TextBox
{
    public partial class TextBox : UserControl
    {
        public TextBox()
        {
            InitializeComponent();
        }
        //左label
        private string actualValue;
        public string ActualValue { 
            get
            {
                return actualValue;
            }
            set
            {
                actualValue = value;
            }
        }
        //右label
        private string unit;
        public  string Unit {
            get
            {
                return unit;
            }
            set
            {
                unit = value;
            }
        }
        //自定义委托类型
        public delegate void BtnClick(object sender,EventArgs e);
        public event BtnClick UserControlClick;
        //标准委托类型
        //EventHandler相当于 public delegate void EventHandler(object sender, EventArgs e);
        public event EventHandler Test;
        private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
        {

        }

        //sender代表事件的发送者，通常是引发事件的对象本身。
        private void left_DoubleClick(object sender, EventArgs e)
        {
            if(UserControlClick != null)
            {
                //把按钮自身作为参数传进
                UserControlClick(sender, new EventArgs());
            }
            //else
            //{
            //    MessageBox.Show("为空！！！");
            //}
        }
    }
}
